/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RPS;

import Rewriting.VariableNameGenerator;
import SPARQL.SPARQL;
import SPARQL.Term;
import SPARQL.TriplePattern;
import SPARQL.Utilities.SPARQLVariableRenamer;
import SPARQL.Variable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author dimartinomirko
 */



public class MappingVariableRenamer extends SPARQLVariableRenamer {
    
    
    public MappingAssertion mapping;
    
    

    public MappingVariableRenamer(MappingAssertion mapping){
    this.varsMap = new HashMap<Variable, Variable>();
    this.mapping = (MappingAssertion) mapping.clone();
    
    }
     
     
    /*
    questo metodo rinomina solo le variabili nel body delle query dei mapping e non quelle nella SELECT
    non e' un rename completo serve solo a fare funzionare il rewriting
    */
    public void renameVariables(){
        
        renameSetTriples(this.mapping.getBody().getTriplePatterns());
        renameSetTriples(this.mapping.getHead().getTriplePatterns());
        renameListTerms(this.mapping.getBody().getSelectVariables());
        renameListTerms(this.mapping.getHead().getSelectVariables());
        
        
        }
    

    public MappingAssertion getMapping() {
        return this.mapping;
        
    }
    
    
}
